<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>
<style type="text/css">
#div1{width:150px; height:150px; background-color:red; position:absolute; left:0; top:50px;}
</style>
</head>
<body>
<input type="button" value="移动"/>
<input type="button" value="停"/>
<div id="div1"></div>
<script src="myJs.js"></script>
<script>
var oBtn = document.getElementsByTagName("input")[0];
var oBtn1 = document.getElementsByTagName("input")[1];
var oDiv = document.getElementById("div1");
var timer = null;
oBtn.onclick = function (){
	clearInterval(timer);
	timer = setInterval(function (){
		oDiv.style.left = parseInt(getStyle(oDiv,"left"))+3+"px";
	},30)
}
oBtn1.onclick = function (){
	clearInterval(timer);
}
</script>
</body>
</html>
